App({
  data: {
    /** 
        * 页面配置 
        */
    winWidth: 0,
    winHeight: 0,
    // tab切换  
    currentTab: 0,
    userInfo: {},
    logged: false,
    user: {},
    code:{}

  },
  onLaunch: function () {
    var that = this;
    wx.login({
      success: function (res) {
        if (res.code) {
          //发起网络请求
          wx.request({
            url: 'https://test.com/onLogin',
            data: {
              code: res.code
              
            }
          })
        } else {
          console.log('登录失败！' + res.errMsg)
        }
      }
    });
  },
checkTab: function (e) {
    var that = this;
  wx.getSetting({
    success: function (res) {
      if (res.authSetting['scope.userInfo']) {
        // 已经授权，可以直接调用 getUserInfo 获取头像昵称
        wx.getUserInfo({
          success: function (res) {
            console(res.userInfo)
          }
        })
      }
    }
  })
},
  bindGetUserInfo: function (e) {
    console.log(e.detail.userInfo)
  }
})
